package com.skyline.wo.service;

import java.util.List;

import com.skyline.common.bean.Page;
import com.skyline.wo.model.Article;

/**
 * AricleService is the business logic operation of the article
 * 
 * @author Jairus Chan
 * @version 0.1
 */
public interface ArticleService {

	/**
	 * add a new Artile
	 * 
	 * @param a
	 *            the new artile
	 */
	public void addArticle(Article a);

	/**
	 * @param articleId
	 *            the id of this article
	 * @param authority
	 *            the read authority of this article
	 * @param ownerId
	 *            the id of this article's owner
	 * @param title
	 *            article's title
	 * @param content
	 *            article's content
	 * @param categoryId
	 *            the name of category which this article is belong to
	 * @param categoryName
	 * 
	 * @return null
	 */
	public void modifyArticle(Long id, Integer authority, Long ownerId, String title, String content, String digest, Long categoryId,
			String categoryName);

	/**
	 * get articles by ownerId
	 * 
	 * @param page
	 *            the param page is used to pagination
	 * @param ownerId
	 *            the id of this article's owner
	 * @param authority
	 *            the read authority of this user own
	 * @return List<Article> the query result is a list
	 */
	public List<Article> getArticleByOwnerId(Page page, Long ownerId, Integer authority);

	/**
	 * get articles by categoryId
	 * 
	 * @param page
	 *            the param page is used to pagination
	 * @param categoryId
	 *            the id of this article's category
	 * @param authority
	 *            the read authority of this user own
	 * @return List<Article> the query result is a list
	 */
	public List<Article> getArticleByCategoryId(Page page, Long categoryId, Long ownerId,Integer authority);

	/**
	 * get prior article
	 * 
	 * @param id
	 *            the id of this article
	 * @param authority
	 *            the read authority of this user own
	 * @return List<Article> the query result is a list
	 */
	public Article getPriorArticle(Long categoryId, Long id, Integer authority);

	/**
	 * get next article
	 * 
	 * @param id
	 *            the id of this article
	 * @param authority
	 *            the read authority of this user own
	 * @return List<Article> the query result is a list
	 */
	public Article getNextArticle(Long categoryId, Long id, Integer authority);

	/**
	 * query article by categoryId
	 * 
	 * @param id
	 *            the id of this article
	 * @return Article
	 */
	public Article getArticleById(Long id);

	/**
	 * add 1 to the read num(read time ) to this article
	 * 
	 * @param id
	 *            the id of this article
	 */
	public void addVisitNum(Long id);

	/**
	 * delete article
	 * 
	 * @param id
	 *            the id of this article
	 * @param actionerId
	 *            the id of the actioner
	 */
	public void deleteArticle(Long id, Long actionerId);

	/**
	 * up this article
	 * 
	 * @param id
	 *            the id of this article
	 */
	public void up(Long id);

	/**
	 * down this article
	 * 
	 * @param id
	 *            the id of this article
	 */
	public void down(Long id);
}
